package com.eling.elcms.travel.webapp.controller;

import com.eling.elcms.core.dao.hibernate.search.SearchCondition;
import com.eling.elcms.core.webapp.controller.BaseFormController;
import com.eling.elcms.core.webapp.controller.Msg;
import com.eling.elcms.core.webapp.spring.ModelFilling;
import com.eling.elcms.travel.model.NonMemberRegister;
import com.eling.elcms.travel.service.INonMemberRegisterManager;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
public class NonMemberRegisterController extends BaseFormController{

	@Autowired
	private INonMemberRegisterManager nonMemRegisterManager;
	
	@RequestMapping("/api/nonmemberregister/save")
    @ResponseBody
	public NonMemberRegister save(@ModelAttribute@ModelFilling NonMemberRegister cond){
		return nonMemRegisterManager.save(cond);
	}
	
	@RequestMapping("/api/nonmemberregister/{pkNonMemberRegister}/delete")
	@ResponseBody
	public Msg delete(@PathVariable Long pkNonMemberRegister){
		nonMemRegisterManager.remove(pkNonMemberRegister);
		return new Msg("删除成功");
	}
	
	@RequestMapping("/api/nonmemberregister/query")
    @ResponseBody
	public List<NonMemberRegister> query(@ModelAttribute NonMemberRegister cond){
		return nonMemRegisterManager.query(cond);
	}
	
	@RequestMapping("/api/nonmemberregister/search*")
	@ResponseBody
	public List<NonMemberRegister> search(@ModelAttribute SearchCondition sc,@ModelAttribute NonMemberRegister cond){
		sc.setQueryCondition(cond);
		return nonMemRegisterManager.search(sc);
	}
	
	@RequestMapping("/api/nonmemberregister/querynoexitgroup")
    @ResponseBody
	public List<NonMemberRegister> queryNoExitgroup(@ModelAttribute NonMemberRegister cond){
		return nonMemRegisterManager.queryNoExitgroup(cond);
	}
}
